<?php

namespace app\api\model;

use think\Model;

class CollectionType extends Model
{
    protected $name = 'user_collection_way';

    //添加新记录
    public function addCollection($uid, $real_name, $mobile, $wechat_qrcode, $card_number,$alipay_qrcode, $remark)
    {
        CollectionType::create([
            'user_id' => $uid,
            'real_name' => $real_name,
            'collection_mobile' => $mobile,
            'wechat_qrcode' => $wechat_qrcode,
            'alipay_qrcode' => $alipay_qrcode,
            'card_number' => $card_number,
            'create_by' => $mobile,
            'create_time' => date('Y-m-d H:i:s'),
            'remark' => $remark,
        ]);
    }

    public function updataCollection($uid, $real_name, $mobile, $wechat_qrcode,$card_number, $alipay_qrcode, $remark)
    {
        CollectionType::where('user_id', $uid)->update([
            'real_name' => $real_name,
            'collection_mobile' => $mobile,
            'wechat_qrcode' => $wechat_qrcode,
            'alipay_qrcode' => $alipay_qrcode,
            'card_number' => $card_number,
            'update_by' => $mobile,
            'update_time' => date('Y-m-d H:i:s'),
            'remark' => $remark,
        ]);
    }
}